package cn.sitedev.lazy;

/**
 * @author qchen
 * @description 懒汉式单例(线程不安全)
 * 优点: 节省了内存
 * 缺点: 线程不安全
 * @date 2020/9/16 22:14
 */
public class Singleton1UnSafe {
    // 声明一个静态实例
    private static Singleton1UnSafe instance;

    // 私有化构造方法
    private Singleton1UnSafe() {

    }

    // 提供全局唯一访问点
    public static Singleton1UnSafe getInstance() {
        if (instance == null) {
            instance = new Singleton1UnSafe();
        }
        return instance;
    }
}
